<!-- Discription: 内容描述, author: ydj, Date: 2023-04-25 10:58:49 -->
<template>
    <div>{{ userStore.name }}</div>
    <el-button @click="update">修改store</el-button>
</template>

<script setup lang="ts">
import { useUserStore } from '@/store/modules/user'
import { login } from '@/api'
import { onMounted } from 'vue';

const userStore = useUserStore()
const update = () => {
    userStore.name = 'lisi'
}
onMounted(() => {
    init()
})

const init = async () => {
    const params = {
        user_name: 'x1',
        password: '111111'
    }
    try {
        const { user_name, token } = await login(params)
        console.log(user_name, token)
    } catch (error) {

    }
}


</script>
<style lang='scss' scoped></style>
